package com.boot.noRepeatSubmitAop;

/**
 * TODO
 *
 * @Project: bidding-20240108
 * @Package: com.bidding.bidder.config
 * @CreateTime: 2024-01-11  08:22
 * @Author: meikq
 * @Version: 1.0
 */
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyRedissonConfig {
    /**
     * 所有对Redisson的使用都是通过RedissonClient对象
     * @return
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redissonClient(){
        // 创建配置 指定redis地址及节点信息
        Config config = new Config();
        config.useSingleServer().setAddress("redis://127.0.0.1:6379");

        // 根据config创建出RedissonClient实例
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;
    }


    /**
     * @description: pom中引入redission依赖
     *          <dependency>
     *             <groupId>org.springframework.boot</groupId>
     *             <artifactId>spring-boot-starter-data-redis</artifactId>
     *         </dependency>
     *         <!-- redisson -->
     *         <dependency>
     *             <groupId>org.redisson</groupId>
     *             <artifactId>redisson</artifactId>
     *             <version>3.9.1</version>
     *         </dependency>
     **/

}
